```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HashMap深度解析 - 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        .hero {
            background: linear-gradient(135deg, #6e8efb, #a777e3);
        }
        .code-block {
            background-color: #282c34;
            color: #abb2bf;
            border-radius: 0.5rem;
            padding: 1rem;
            font-family: 'Courier New', Courier, monospace;
            position: relative;
        }
        .code-block::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: linear-gradient(to bottom, #e66465, #9198e5);
            border-radius: 0.5rem 0 0 0.5rem;
        }
        .card {
            transition: all 0.3s ease;
            border-radius: 0.5rem;
            overflow: hidden;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .feature-icon {
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            margin-bottom: 1rem;
        }
        .hover-underline-animation {
            display: inline-block;
            position: relative;
        }
        .hover-underline-animation::after {
            content: '';
            position: absolute;
            width: 100%;
            transform: scaleX(0);
            height: 2px;
            bottom: 0;
            left: 0;
            background-color: #6e8efb;
            transform-origin: bottom right;
            transition: transform 0.25s ease-out;
        }
        .hover-underline-animation:hover::after {
            transform: scaleX(1);
            transform-origin: bottom left;
        }
        .diagram-container {
            background: #f8f9fa;
            border-radius: 0.5rem;
            padding: 1.5rem;
            margin: 1.5rem 0;
        }
        .footer-link:hover {
            color: #a777e3 !important;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4">HashMap深度解析</h1>
                    <p class="text-xl mb-6">探索Java集合框架中最常用的数据结构之一</p>
                    <div class="flex space-x-4">
                        <div class="flex items-center">
                            <i class="fas fa-code-branch mr-2"></i>
                            <span>数组+链表+红黑树</span>
                        </div>
                        <div class="flex items-center">
                            <i class="fas fa-bolt mr-2"></i>
                            <span>O(1)时间复杂度</span>
                        </div>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="bg-white bg-opacity-20 p-6 rounded-lg backdrop-blur-sm">
                        <div class="text-lg font-semibold mb-4">核心特性概览</div>
                        <ul class="space-y-3">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2 text-green-200"></i>
                                <span>基于哈希表的Map接口实现</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2 text-green-200"></i>
                                <span>允许null键和null值</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2 text-green-200"></i>
                                <span>非线程安全，高效的单线程实现</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2 text-green-200"></i>
                                <span>Java 8引入红黑树优化性能</span>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-5xl mx-auto py-12 px-4 sm:px-6 lg:px-8">
        <!-- Overview Section -->
        <section class="mb-16">
            <div class="prose prose-lg max-w-none">
                <p class="text-gray-700">
                    <span class="font-bold text-indigo-600">HashMap</span> 的底层实现基于数组和链表（在 Java 1.8 之后，链表可能会被红黑树替代），使用哈希算法来处理键值对的存储。它提供了高效的插入、查找和删除操作，同时通过扩容机制来保持性能。<span class="font-bold text-indigo-600">HashMap</span> 是一个非线程安全的集合类，但在单线程环境中具有良好的性能表现。对于需要线程安全的哈希表实现，可以使用 <span class="font-bold text-indigo-600">ConcurrentHashMap</span>。
                </p>
            </div>
        </section>

        <!-- Data Structure Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">1</span>
                数据结构
            </h2>
            
            <div class="prose prose-lg max-w-none mb-8">
                <p><span class="font-bold text-indigo-600">HashMap</span> 的底层实现主要依赖于数组和链表（在 Java 1.8 之后，链表可能会被红黑树替代）：</p>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6 mb-8">
                <div class="card bg-white p-6 shadow-md">
                    <div class="feature-icon bg-indigo-100 text-indigo-600">
                        <i class="fas fa-th-large text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-2">数组</h3>
                    <p class="text-gray-700"><span class="font-bold text-indigo-600">HashMap</span> 内部使用一个数组来存储数据。每个数组位置称为"桶"或"槽"，用于存储哈希冲突的元素。</p>
                </div>
                
                <div class="card bg-white p-6 shadow-md">
                    <div class="feature-icon bg-green-100 text-green-600">
                        <i class="fas fa-link text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-2">链表</h3>
                    <p class="text-gray-700">当多个键的哈希值映射到同一个桶时，这些元素会被存储在一个链表中。每个链表节点包含一个键值对。</p>
                </div>
                
                <div class="card bg-white p-6 shadow-md">
                    <div class="feature-icon bg-red-100 text-red-600">
                        <i class="fas fa-tree text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-2">红黑树</h3>
                    <p class="text-gray-700">从 Java 1.8 开始，当某个桶中的链表长度超过阈值（默认为 8），链表会被转换为红黑树，以提升性能。红黑树是一种自平衡的二叉搜索树，提供了对数级别的查找时间复杂度。</p>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-bold mb-4">JDK 1.7 结构</h3>
                    <div class="diagram-container">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634177022263-ff270e33-c07c-4e77-8402-d3cad93ce036.png" alt="JDK 1.7 HashMap 结构" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
                <div>
                    <h3 class="text-xl font-bold mb-4">JDK 1.8 结构</h3>
                    <div class="diagram-container">
                        <div class="flex justify-center items-center h-full">
                            <div class="text-center">
                                <i class="fas fa-tree text-4xl text-green-600 mb-2"></i>
                                <p class="font-bold">数组+链表+红黑树</p>
                                <p class="text-sm text-gray-600 mt-2">初始化的时候还是数组+链表，只有Map中的数据达到一定量(链表长度大于7和数组长度查过64)时候才会把链表转成红黑树。</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Hash Algorithm Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">2</span>
                哈希算法
            </h2>
            
            <div class="prose prose-lg max-w-none mb-8">
                <p><span class="font-bold text-indigo-600">HashMap</span> 使用哈希函数将键映射到桶中。具体来说：</p>
            </div>
            
            <div class="grid md:grid-cols-2 gap-6 mb-8">
                <div class="card bg-white p-6 shadow-md">
                    <h3 class="text-xl font-bold mb-2">哈希码</h3>
                    <p class="text-gray-700 mb-4"><span class="font-bold text-indigo-600">HashMap</span> 使用对象的 <code class="bg-gray-100 px-2 py-1 rounded">hashCode()</code> 方法计算哈希码。</p>
                </div>
                
                <div class="card bg-white p-6 shadow-md">
                    <h3 class="text-xl font-bold mb-2">扰动函数</h3>
                    <p class="text-gray-700">在 Java 1.8 中，哈希码经过扰动处理，以减少哈希冲突的可能性。具体实现是将哈希码的高位和低位做异或操作，改善哈希分布。</p>
                </div>
            </div>
            
            <div class="mb-8">
                <h3 class="text-xl font-bold mb-4">哈希计算代码示例</h3>
                <div class="code-block">
                    <pre><code class="text-sm">int hash = hashCode();
hash ^= (hash >>> 20) ^ (hash >>> 12);
return hash ^ (hash >>> 7) ^ (hash >>> 4);</code></pre>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-bold mb-4">JDK 1.7 哈希计算</h3>
                    <div class="diagram-container">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634262301439-8ca0b22c-032a-4261-9be1-a661eff4dcdc.png" alt="JDK 1.7 哈希计算" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
                <div>
                    <h3 class="text-xl font-bold mb-4">JDK 1.8 哈希计算</h3>
                    <div class="diagram-container">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634262332401-70e37b45-c7e3-4f3e-a055-50f1c787bc33.png" alt="JDK 1.8 哈希计算" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
            </div>
        </section>

        <!-- Basic Operations Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">3</span>
                基本操作
            </h2>
            
            <div class="grid md:grid-cols-3 gap-6 mb-8">
                <div class="card bg-white p-6 shadow-md">
                    <div class="feature-icon bg-blue-100 text-blue-600">
                        <i class="fas fa-plus-circle text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-2">插入 (put)</h3>
                    <p class="text-gray-700">当调用 <code class="bg-gray-100 px-1 py-0.5 rounded">put(key, value)</code> 时，<span class="font-bold text-indigo-600">HashMap</span> 首先计算键的哈希值并找到相应的桶。如果该桶为空，则直接插入。如果桶中已有元素，则检查键是否已存在于链表中。如果存在，则更新值；如果不存在，则将新的键值对添加到链表末尾（或转换为红黑树）。</p>
                </div>
                
                <div class="card bg-white p-6 shadow-md">
                    <div class="feature-icon bg-purple-100 text-purple-600">
                        <i class="fas fa-search text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-2">查找 (get)</h3>
                    <p class="text-gray-700">查找时，<span class="font-bold text-indigo-600">HashMap</span> 计算键的哈希值，并找到对应的桶。然后遍历桶中的链表（或红黑树），比较键以找到对应的值。</p>
                </div>
                
                <div class="card bg-white p-6 shadow-md">
                    <div class="feature-icon bg-red-100 text-red-600">
                        <i class="fas fa-trash-alt text-xl"></i>
                    </div>
                    <h3 class="text-xl font-bold mb-2">删除 (remove)</h3>
                    <p class="text-gray-700">删除时，<span class="font-bold text-indigo-600">HashMap</span> 计算键的哈希值，找到对应的桶，然后遍历链表（或红黑树），找到并移除对应的键值对。如果链表或红黑树的长度减少到一定程度（默认为 6），链表会重新转换为链表。</p>
                </div>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <h3 class="text-xl font-bold mb-4">put方法执行流程</h3>
                    <div class="diagram-container">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634176901130-bfcec911-6a0b-4a8a-bc97-3333dd402836.png" alt="put方法执行流程" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
                <div>
                    <h3 class="text-xl font-bold mb-4">get方法执行流程</h3>
                    <div class="diagram-container">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634177571256-f654bf75-ac1d-48c4-ae1f-b76247d86fec.png" alt="get方法执行流程" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
            </div>
        </section>

        <!-- Expansion Mechanism Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">4</span>
                扩容机制
            </h2>
            
            <div class="grid md:grid-cols-2 gap-6 mb-8">
                <div class="card bg-white p-6 shadow-md">
                    <h3 class="text-xl font-bold mb-2">触发条件</h3>
                    <p class="text-gray-700">当 <span class="font-bold text-indigo-600">HashMap</span> 中的元素数量超过负载因子（默认 0.75）与当前容量的乘积时，会触发扩容。比如，如果容量为 16，当元素数量超过 12 时触发扩容。</p>
                </div>
                
                <div class="card bg-white p-6 shadow-md">
                    <h3 class="text-xl font-bold mb-2">扩容过程</h3>
                    <p class="text-gray-700">扩容时，<span class="font-bold text-indigo-600">HashMap</span> 将数组的容量扩大为原容量的两倍。所有的键值对会重新计算哈希值，并迁移到新的桶中。这个过程是一个 O(n) 的操作，因为所有的元素都需要重新哈希并移动到新的数组位置。</p>
                </div>
            </div>
            
            <div class="diagram-container">
                <div class="flex flex-col md:flex-row items-center">
                    <div class="md:w-1/2 mb-6 md:mb-0">
                        <h3 class="text-xl font-bold mb-4">JDK 1.7是如何做扩容的？</h3>
                        <p class="text-gray-700 mb-4">a) 什么时候做扩容？</p>
                        <p class="text-gray-700 mb-4">b) 扩容后的数组的长度是多少？</p>
                        <p class="text-purple-700 font-medium">size(key的数量) > threshold = (int)Math.min(newCapacity * loadFactor, MAXIMUM_CAPACITY + 1) 数组开始扩容。</p>
                    </div>
                    <div class="md:w-1/2">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634260963281-7753e786-0681-4a65-bcd6-533378be85a0.png" alt="JDK 1.7 扩容机制" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
            </div>
        </section>

        <!-- Performance Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">5</span>
                性能
            </h2>
            
            <div class="grid md:grid-cols-2 gap-6">
                <div class="card bg-white p-6 shadow-md">
                    <h3 class="text-xl font-bold mb-2">时间复杂度</h3>
                    <ul class="list-disc pl-5 space-y-2 text-gray-700">
                        <li><strong>插入、查找和删除</strong>：在平均情况下，这些操作的时间复杂度是 O(1)，但在最坏情况下（所有元素都映射到同一个桶中），时间复杂度会退化到 O(n)。在 Java 1.8 中，长链表会被转换为红黑树，这样可以将最坏情况下的时间复杂度降低到 O(log n)。</li>
                    </ul>
                </div>
                
                <div class="card bg-white p-6 shadow-md">
                    <h3 class="text-xl font-bold mb-2">空间复杂度</h3>
                    <p class="text-gray-700"><span class="font-bold text-indigo-600">HashMap</span> 的空间复杂度主要取决于元素数量和桶的容量。扩容时，会占用额外的内存空间，但在正常操作下，<span class="font-bold text-indigo-600">HashMap</span> 会保持较高的空间效率。</p>
                </div>
            </div>
        </section>

        <!-- Thread Safety Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">6</span>
                线程安全
            </h2>
            
            <div class="card bg-white p-6 shadow-md">
                <p class="text-gray-700"><span class="font-bold text-indigo-600">HashMap</span> 不是线程安全的。在多线程环境中，多个线程同时对 <span class="font-bold text-indigo-600">HashMap</span> 进行修改可能导致数据不一致。为了在多线程环境中使用线程安全的哈希表，可以使用 <span class="font-bold text-indigo-600">ConcurrentHashMap</span>。</p>
            </div>
        </section>

        <!-- Load Factor Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">7</span>
                负载因子和初始容量
            </h2>
            
            <div class="grid md:grid-cols-2 gap-6">
                <div class="card bg-white p-6 shadow-md">
                    <h3 class="text-xl font-bold mb-2">初始容量</h3>
                    <p class="text-gray-700"><span class="font-bold text-indigo-600">HashMap</span> 的初始容量是创建时指定的桶数组的大小。如果没有指定，默认初始容量为 16。</p>
                </div>
                
                <div class="card bg-white p-6 shadow-md">
                    <h3 class="text-xl font-bold mb-2">负载因子</h3>
                    <p class="text-gray-700">负载因子决定了在扩容之前允许的最大填充比例。默认负载因子为 0.75。这意味着当 <span class="font-bold text-indigo-600">HashMap</span> 中的元素数量达到容量与负载因子的乘积时，就会触发扩容。</p>
                </div>
            </div>
        </section>

        <!-- Iterator Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">8</span>
                迭代器
            </h2>
            
            <div class="card bg-white p-6 shadow-md">
                <p class="text-gray-700 mb-4"><span class="font-bold text-indigo-600">HashMap</span> 提供了多种迭代器用于遍历元素：</p>
                <ul class="list-disc pl-5 space-y-2">
                    <li><code class="bg-gray-100 px-2 py-1 rounded">keySet()</code>: 返回一个包含所有键的 <code class="bg-gray-100 px-1 py-0.5 rounded">Set</code>，通过它可以遍历所有键。</li>
                    <li><code class="bg-gray-100 px-2 py-1 rounded">values()</code>: 返回一个包含所有值的 <code class="bg-gray-100 px-1 py-0.5 rounded">Collection</code>，通过它可以遍历所有值。</li>
                    <li><code class="bg-gray-100 px-2 py-1 rounded">entrySet()</code>: 返回一个包含所有键值对的 <code class="bg-gray-100 px-1 py-0.5 rounded">Set</code>，通过它可以遍历所有的键值对。</li>
                </ul>
            </div>
        </section>

        <!-- Source Code Analysis Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 flex items-center">
                <span class="bg-indigo-100 text-indigo-800 w-10 h-10 rounded-full flex items-center justify-center mr-4">9</span>
                源码分析
            </h2>
            
            <div class="prose prose-lg max-w-none mb-8">
                <p>1、HashMap的底层实现</p>
                <p class="font-bold">jdk1.7 数组+链表</p>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <div class="diagram-container">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634087588508-333f95fc-80db-4e96-b736-bc83306b2750.png" alt="HashMap 源码" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
                <div>
                    <div class="diagram-container">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634177022263-ff270e33-c07c-4e77-8402-d3cad93ce036.png" alt="JDK 1.7 结构" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
            </div>
            
            <div class="mt-12">
                <h3 class="text-2xl font-bold mb-6">JDK 1.8 源码分析</h3>
                
                <div class="grid md:grid-cols-2 gap-8">
                    <div>
                        <h4 class="text-xl font-bold mb-4">构造器</h4>
                        <div class="diagram-container">
                            <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634262230485-1c3f5f33-c804-4e94-8303-71b80d6c065d.png" alt="JDK 1.8 构造器" class="rounded-lg shadow-sm w-full">
                        </div>
                    </div>
                    <div>
                        <h4 class="text-xl font-bold mb-4">put方法</h4>
                        <div class="diagram-container">
                            <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634262392506-6611a8b2-1a85-4b59-8bd0-f36bbbef8cc8.png" alt="JDK 1.8 put方法" class="rounded-lg shadow-sm w-full">
                        </div>
                    </div>
                </div>
                
                <div class="mt-8">
                    <h4 class="text-xl font-bold mb-4">get方法</h4>
                    <div class="diagram-container">
                        <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634520167014-b6666644-5a9c-4e61-a9b1-c956f81fbccb.png" alt="JDK 1.8 get方法" class="rounded-lg shadow-sm w-full">
                    </div>
                </div>
                
                <div class="mt-8 grid md:grid-cols-2 gap-8">
                    <div>
                        <h4 class="text-xl font-bold mb-4">remove方法</h4>
                        <div class="diagram-container">
                            <img src="https://cdn.nlark.com/yuque/0/2022/png/21449790/1644820468740-68c923b9-56e7-4e4b-8cd1-975f61e851d4.png" alt="JDK 1.8 remove方法" class="rounded-lg shadow-sm w-full">
                        </div>
                    </div>
                    <div>
                        <h4 class="text-xl font-bold mb-4">clean方法</h4>
                        <div class="diagram-container">
                            <img src="https://cdn.nlark.com/yuque/0/2021/png/21449790/1634520786925-18e0b39b-049b-4523-9a57-b3afef647b20.png" alt="JDK 1.8 clean方法" class="rounded-lg shadow-sm w-full">
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-white py-12 px-4 sm:px-6 lg:px-8">
        <div class="max-w-5xl mx-auto">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-6 md:mb-0">
                    <h3 class="text-2xl font-bold mb-2">技术小馆</h3>
                    <p class="text-gray-400">探索技术之美，分享编程之道</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="footer-link text-gray-300 hover:text-white transition-colors duration-300">
                        <i class="fas fa-globe mr-2"></i>http://www.yuque.com/jtostring
                    </a>
                </div>
            </div>
            <div class="mt-8 pt-8 border-t border-gray-800 text-center text-gray-400 text-sm">
                <p>© 2023 技术小馆. 保留所有权利.</p>
            </div>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 初始化Mermaid图表
            mermaid.initialize({
                startOnLoad: true,
                theme: 'default',
                flowchart: {
                    useMaxWidth: true,
                    htmlLabels: true,
                    curve: 'basis'
                }
            });
            
            // 添加平滑滚动效果
            document.querySelectorAll('a[href^="#"]').forEach(anchor => {
                anchor.addEventListener('click', function (e) {
                    e.preventDefault();
                    document.querySelector(this.getAttribute('href')).scrollIntoView({
                        behavior: 'smooth'
                    });
                });
            });
        });
    </script>
</body>
</html>
```